﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;

namespace ToDoBasket.Converter
{
    class ImportanceConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string str = value as string;
            int importance = str == null ? 0 : str.Length;
            SolidColorBrush brush;
            switch (importance)
            {
                case 0: brush = new SolidColorBrush(Colors.Transparent); break;
                case 1: brush = Application.Current.FindResource("GreenBrush") as SolidColorBrush; break;
                case 2: brush = Application.Current.FindResource("OrangeBrush") as SolidColorBrush; break;
                default: brush = Application.Current.FindResource("RedBrush") as SolidColorBrush; break;
            }
            return brush;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
